push key and value in laravel

41

public function index()
{
    $collection = collect(['id' => 1, 'name' => 'Hardik']);
  
    $collection->put('role', 'admin');
   
    $collection->all();
      
    dd($collection);
}

Comments

Submit
0 Comments